<?php
use yii\helpers\Html;
use yii\helpers\Url;
?>
<tr>
    <td><?=$index + 1?></td>
    <td><?=$model['id']?></td>
    <td><?=$model['name']?></td>
    <td><?=$model['description']?></td>
    <td><?=!empty($model['flagActive']) ? ($model['flagActive']==1 ? Yii::t('debug', 'Active') : Yii::t('debug', 'Disable')) : ''?></td>
    <td>
        <?php if($model['flag']==1):?>
            <?php echo Html::a(Yii::t('debug', '更新Database'), ['/backendclient/module/default/update', 'id'=>$model['id']], ['class'=>'btn btn-primary btn-sm']); ?>
            
        <!-- 已安裝 -->
            <?php if($model['flagActive']==1):?>
            <?php echo Html::a(Yii::t('debug', 'Disable'), ['view','type'=>'change', 'id'=>$model['id']], ['class'=>'btn btn-primary btn-sm']); ?>
            <?php echo Html::a(Yii::t('debug', 'Create Model'), ['/backendclient/module/gii', 'id'=>$model['id']], ['class'=>'btn btn-primary btn-sm']); ?>
            <?php echo Html::a(Yii::t('debug', 'Create CRUD'), ['/backendclient/module/gii', 'id'=>$model['id'], 'type'=>'curd'], ['class'=>'btn btn-primary btn-sm']); ?>
            <?php else:?>
            <?php echo Html::a(Yii::t('debug', 'Active'), ['view','type'=>'change', 'id'=>$model['id']], ['class'=>'btn btn-primary btn-sm']); ?>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <?php echo Html::a(Yii::t('debug', 'Uninstall'), ['view','type'=>'uninstall', 'id'=>$model['id']], ['data' => ['method' => 'post', 'confirm'=>Yii::t('debug', 'Are you sure you want to uninstall this module?')]]); ?>
            <?php endif;?> 
        <?php else:?>
        <!-- 未安裝 -->
        <?php echo Html::a(Yii::t('debug', 'Install'), ['view','type'=>'install', 'id'=>$model['id']], ['class'=>'btn btn-primary btn-sm']); ?>
        &nbsp;&nbsp;&nbsp;&nbsp;
        <?php echo Html::a(Yii::t('debug', 'Remove'), ['view','type'=>'remove', 'id'=>$model['id']], ['data' => ['method' => 'post', 'confirm'=>Yii::t('debug', 'Are you sure you want to remove this module?')]]); ?>
          
        <?php endif;?>
    </td>

</tr>
